<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算属性</title>
    <script src="vue/vue.js"></script>
</head>
<body>
<div id="app">
    <span>{{a}}</span>
    <span>{{b}}</span>

</div>
<script>
    let vm=new Vue({
        el:"#app",
        data:{
            a:10
        },
        computed:{
            //属性 业务逻辑
            b:{
                get:function(){
                    return this.a+20
                },
                set:function (val) {
                    this.a=val
                }
            }
        }
    });
    document.onclick=function () {
        vm.a=100;
    }
</script>
</body>
</html>